import { useState } from "react";

const useNumValid = () => {
    const [value, setValue] = useState('');
    const onChange = e => {
        setValue(e.target.value);
    }
    const err = /^\d+$/.test(value) || !value ?'':'请输入数字'
    return { value, onChange, err }
}

export default useNumValid;